/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.afcepf.projet2.metiers.donnees.entites.catalogue;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.validation.constraints.Size;

/**
 *
 * @author sylva_000
 */
@Entity
@NamedQueries({
    @NamedQuery(name = "Categorie.findBySite", 
        query = "SELECT c FROM Categorie c WHERE c.site =:site"),
    @NamedQuery(name = "Categorie.findByNom", 
	query = "SELECT c FROM Categorie c WHERE c.categorie =:categorie"),
    @NamedQuery(name = "Categorie.findById", 
	query = "SELECT c FROM Categorie c WHERE c.idCategorie =:idCategorie"),
    @NamedQuery(name = "Categorie.findByCategorie", 
        query = "SELECT c FROM Categorie c WHERE c.categorie = :categorie")})
public class Categorie implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name="idCategorie")
    private Integer idCategorie;

    @Column(name="Categorie")
    private String categorie;
    
    @Size(max = 255)
    @Column(name = "Photo")
    private String photo;

    @Column(name="Site")
    private String site;
    
    public Integer getIdCategorie() {
        return idCategorie;
    }

    public void setIdCategorie(Integer idCategorie) {
        this.idCategorie = idCategorie;
    }

    public String getCategorie() {
        return categorie;
    }

    public void setCategorie(String categorie) {
        this.categorie = categorie;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCategorie != null ? idCategorie.hashCode() : 0);
        return hash;
    }

    public String getPhoto() {
        return photo;
    }

    public void setPhoto(String photo) {
        this.photo = photo;
    }

    /**
     * Obitent l'identifiant du site demandeur
     * @return nom du site
     */
    public String getSite() {
        return site;
    }

    /**
     * Défini le site demandeur
     * @param site nom du site
     */
    public void setSite(String site) {
        this.site = site;
    }
    
    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Categorie)) {
            return false;
        }
        Categorie other = (Categorie) object;
        if ((this.idCategorie == null && other.idCategorie != null) || (this.idCategorie != null && !this.idCategorie.equals(other.idCategorie))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.afcepf.projet2.entities.catalogue.Categorie[ id=" + idCategorie + " ]";
    }
    
}
